CC=gcc
CFLAGS=-Wall -D_GNU_SOURCE

OBJ_FILES=simple dedup lruDedup lruDedup10 lruStep5 lruStep20 delayWrite delay5 delay20 delay100

all: ${OBJ_FILES}
	$(MAKE) move

simple: directIO.c
	$(CC) $(CFLAGS) -o $@ $<

dedup: directIO.c
	$(CC) $(CFLAGS) -D DEDUP -o $@ $<

lruDedup: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -o $@ $<

lruDedup10: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -o $@ $<

lruStep5: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D FSYNCSTEP=5 -o $@ $<

lruStep20: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D FSYNCSTEP=20 -o $@ $<

delayWrite: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D DELAY_WRITE -o $@ $<

delay5: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D DELAY_WRITE -D FSYNCSTEP=5 -o $@ $<

delay20: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D DELAY_WRITE -D FSYNCSTEP=20 -o $@ $<

delay100: lruDirectIO.c
	$(CC) $(CFLAGS) -D DEDUP -D metablk_inMem_max=10 -D DELAY_WRITE -D FSYNCSTEP=100 -o $@ $<

.PHONY: move
move:
	mkdir -p build
	mv ${OBJ_FILES} build/

clean:
	rm -rf build/
